/*
 * Copyright (c) 2024 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "common/common.h"
namespace ArkUICapiTest {

static napi_value TestCheckboxSelect001(napi_env env, napi_callback_info info)
{
    NAPI_START(checkbox, ARKUI_NODE_CHECKBOX);
    int32_t select = true;
    ArkUI_NumberValue select_value[] = {{.i32 = select}};
    ArkUI_AttributeItem select_item = {select_value, sizeof(select_value) / sizeof(ArkUI_NumberValue)};
    auto ret = nodeAPI->setAttribute(checkbox, NODE_CHECKBOX_SELECT, &select_item);
    ASSERT_EQ(ret, SUCCESS);
    ASSERT_EQ(nodeAPI->getAttribute(checkbox, NODE_CHECKBOX_SELECT)->value[PARAM_0].i32, select);
    NAPI_END;
}

static napi_value TestCheckboxSelect002(napi_env env, napi_callback_info info)
{
    NAPI_START(checkbox, ARKUI_NODE_CHECKBOX);
    int32_t select = false;
    ArkUI_NumberValue select_value[] = {{.i32 = select}};
    ArkUI_AttributeItem select_item = {select_value, sizeof(select_value) / sizeof(ArkUI_NumberValue)};
    auto ret = nodeAPI->setAttribute(checkbox, NODE_CHECKBOX_SELECT, &select_item);
    ASSERT_EQ(ret, SUCCESS);
    ASSERT_EQ(nodeAPI->getAttribute(checkbox, NODE_CHECKBOX_SELECT)->value[PARAM_0].i32, select);
    NAPI_END;
}

static napi_value TestCheckboxSelect003(napi_env env, napi_callback_info info)
{
    NAPI_START(checkbox, ARKUI_NODE_CHECKBOX);
    ASSERT_EQ(nodeAPI->getAttribute(checkbox, NODE_CHECKBOX_SELECT)->value[PARAM_0].i32, false);
    NAPI_END;
}

} // namespace ArkUICapiTest